﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="teacherlogin.aspx.cs" Inherits="Manage_teacherlogin" %>
<!doctype html>
<html>
<head id="Head1" runat="server">
    <title><%=ExamSys.ExamSysName%> <%=ExamSys.ExamSysDesc%></title>
    <style>
html, body {height:100%;background-color:#333;}
html body{font:12px Arial, Helvetica, sans-serif;color:#333333}
html>body{font:12px Arial, Helvetica, sans-serif;color:#333333}
#TB_overlay {
	position: absolute;
	top: 0;
	left: 0;
	z-index:100;
	width: 100%;
	height: 100%;
	background-color:#CCC;
	filter:alpha(opacity=60);
	-moz-opacity: 0.6;
	opacity: 0.6;
}
#TB_window {
	top: 0px;
	left: 0px;
	position: fixed;
	_position: absolute;
	background: #fff;
	z-index: 102;
	color:#000000;
	display:none;
	border:5px solid #666;
}
#TB_caption{
	height:25px;
	padding:10px 30px 10px 25px;
}
#TB_closeWindow{
	height:25px;
	padding:10px 25px 10px 0;
	float:right;
}
#TB_closeAjaxWindow{
	padding:5px 10px 7px 0;
	margin-bottom:1px;
	text-align:right;
	background-color:#e8e8e8;
}
#TB_ajaxContent{
	padding:10px 10px 10px 10px;
	overflow:auto;
}

#TB_load{
	text-align: center;
	position: absolute;
	top: 50%;
	left: 0px;
	width: 100%;
	overflow: visible;
	visibility: visible;
	display: block;
	z-index:101;
}
#TB_loadContent{
	margin-left: -125px;
	position: absolute;
	top: -50px;
	left: 50%;
	width: 250px;
	height: 100px;
	visibility: visible;
}
    </style>
    <STYLE type=text/css>
        * {
	        BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; BORDER-TOP: 0px; BORDER-RIGHT: 0px; PADDING-TOP: 0px
        }
        BODY {
	        FONT: 12px "宋体"
        }
        A {
	        COLOR: #000; TEXT-DECORATION: none
        }
        A:hover {
	        COLOR: #f30; TEXT-DECORATION: underline
        }
        INPUT {
	        PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px
        }
        .txtbox {
	        BORDER-BOTTOM: #e79f50 1px solid; BORDER-LEFT: #e79f50 1px solid; LINE-HEIGHT: 22px; WIDTH: 120px; HEIGHT: 20px; BORDER-TOP: #e79f50 1px solid; BORDER-RIGHT: #e79f50 1px solid
        }
        .bfont {
	        FONT: 700 12px "宋体"
        }
        #title {
	        TEXT-ALIGN: center; LINE-HEIGHT: 25px; BACKGROUND-COLOR: #fdebd9; MARGIN: 0px auto; WIDTH: 400px; HEIGHT: 25px; COLOR: #f60; FONT-WEIGHT: 700
        }
        #loginbox {
	        MARGIN: 10px 20px; WIDTH: 185px; DISPLAY: inline; FLOAT: left; HEIGHT: 60px
        }
        #btnlogin {
	        MARGIN: 10px 30px 10px 5px; WIDTH: 55px; FLOAT: right; HEIGHT: 60px
        }
        #forget {
	        TEXT-ALIGN: center; LINE-HEIGHT: 25px; MARGIN: 0px auto; WIDTH: 200px; HEIGHT: 25px
        }
        #forget SPAN {
	        MARGIN: 0px 10px; WIDTH: 80px; DISPLAY: inline
        }
        </STYLE>
        <script type="text/javascript" src="../js/jquery/jquery-1.4.4.min.js"></script>
        <script>
            var _url = "";
            var COOKIE_NAME = "<%=ExamSys.teacher_cookiesname.Trim() %>";
            $(function () {
                if (!navigator.cookieEnabled) {
                    alert("请您打开浏览器的Cookie功能！");
                    return false;
                }
                //登录
                $("#btnlogin").click(function () {
                    var _xuehao = $("#xuehao");
                    var _pwd = $("#pwd");
                    if (_xuehao.val() == "") {
                        $("#logininfo").html("<img class='erro' src='../images/erro.gif' style='vertical-align:middle' width='16' height='16' border=0 /> 请输入帐号");
                        _xuehao.focus();
                        return false;
                    }
                    if (_pwd.val() == "") {
                        $("#logininfo").html("<img class='erro' src='../images/erro.gif' style='vertical-align:middle' width='16' height='16' border=0 /> 请输入密码");
                        _pwd.focus();
                        return false;
                    }

                    $.ajax({
                        type: "POST", cache: false, url: "service/tlogin.aspx?t=" + new Date().getTime(), data: "n=" + _xuehao.val() + "&p=" + _pwd.val() + "&tt=0",
                        beforeSend: function () { },
                        success: function (getdata) {
                            if (getdata == "e0") {
                                $("#logininfo").html("<img class='erro' src='../images/erro.gif' style='vertical-align:middle' width='16' height='16' border=0 /> 帐号不存在，请联系管理员");
                                _xuehao.focus(); return false;
                            }
                            if (getdata == "e1") {
                                $("#logininfo").html("<img class='erro' src='../images/erro.gif' style='vertical-align:middle' width='16' height='16' border=0 /> 密码不正确");
                                _pwd.focus(); return false;
                            }

                            if (getdata == "e3") {
                                $("#logininfo").html("<img class='erro' src='../images/erro.gif' style='vertical-align:middle' width='16' height='16' border=0 /> 发生错误");
                                _xuehao.focus(); return false;
                            } else if (getdata == "ok") {
                                $("#logininfo").html("<img class='ok' src='../images/ok.gif' style='vertical-align:middle' width='16' height='16' border=0 /> 登录成功。");
                                //setCookies(email.val(), password.val(), getdata);
                                if (_url != "") {
                                    window.location.href = _url;
                                } else {
                                    window.location.href = "default.aspx";
                                }
                            } else {
                                $("#logininfo").html("<img class='erro' src='../images/erro.gif' style='vertical-align:middle' width='16' height='16' border=0 /> 发生错误，请联系管理员");
                                _xuehao.focus(); return false;
                            }
                        },
                        complete: function () { },
                        error: function (getdata) {
                            $("#logininfo").html("<img class='erro' src='../images/erro.gif' style='vertical-align:middle' width='16' height='16' border=0 /> 发生错误，请联系管理员");
                        }
                    });
                    return false;
                });

            })
            function setCookies(mail, pwd, uid) {
                var options = { path: '/', expires: 10 };
                var json_str = "";
                $.cookie(COOKIE_NAME, json_str, options);
            }
        </script>
</head>
<body>
    <form id="form1" runat="server">

        <div style="height:250px;"></div>
        <DIV style="WIDTH: 400px;background-COLOR:#CCC;MARGIN:0 auto;" id=TB_ajaxContent>
        <DIV id=login style="background-COLOR:#FFF;">
        <DIV id=title>培训师登录 <%=ExamSys.ExamSysName%> </DIV>
        <DIV style="MARGIN: 0px auto; WIDTH: 320px; HEIGHT: 80px">
        <TABLE id=loginbox border=0 cellSpacing=0 cellPadding=0>
        <TBODY>
        <TR style="HEIGHT: 30px">
        <TD class=bfont>帐&nbsp;&nbsp;号：</TD>
        <TD><INPUT id="xuehao" class=txtbox type=text maxlength="20" name=username></TD></TR>
        <TR>
        <TD class=bfont>密&nbsp;&nbsp;码：</TD>
        <TD><INPUT id="pwd" class=txtbox value="" maxlength="20" type=password name=password></TD></TR></TBODY></TABLE>
        <DIV id=btnlogin><A href="javascript:void(0)"><IMG src="../images/login.gif" width=55 height=55></A></DIV></DIV>

        <DIV style="TEXT-ALIGN: center; LINE-HEIGHT: 25px; HEIGHT: 25px" id="logininfo">您只有登陆后才能管理试卷</DIV>
        
        </DIV></DIV>

    </form>
</body>
</html>
